const express = require('express')
const app = express()

app.use((request, response, next) => {
    console.log('有人请求服务器1了');
    next()
})

app.get('/students', (request, response) => {
    const students = [
        { id: '001', name: '魏卫浩' },
        { id: '002', name: '周杰伦' },
        { id: '003', name: '邓紫棋' },
    ]
    response.send(students)
})

app.listen(5000, (err) => {
    if (!err) console.log('服务器1启动成功了,请求信息地址为：http://localhost:5000/students');
})